#include <iostream>
#include <memory>

struct unreferenceable {
    int x;
    unreferenceable* operator&() { return nullptr; }
};

void print(unreferenceable* m)
{
    if (m)
        std::cout << m->x << std::endl;
    else
        std::cerr << "null pointer" << std::endl;
}

int main()
{
    void (*pfn)(unreferenceable *) = std::addressof(print);

    unreferenceable val {10};
    unreferenceable *foo = &val;
    unreferenceable *bar = std::addressof(val);

    (*pfn)(foo);
    (*pfn)(bar);


    return 0;
}
